package jpa4azure.impl;

import java.util.Date;

import jpa4azure.type.Key;
import jpa4azure.util.DateUtil;

public class TimestampKey extends Key {

	public TimestampKey(String p, String r) {
		super(p, r);
	}
	
	public TimestampKey(String p, Date timestamp) {
		partition = p;
		setRow(timestamp);		
	}
	
	public TimestampKey(String partition) {
		setRow(new Date());
		this.partition = partition;
	}
	
	private void setRow(Date d) {
		this.row = DateUtil.asKey(d);
	}
	
	public <T> TimestampQueryable<T> find(Class<T> class1) {
		return new TimestampKeyQuery<T>(class1, this);
	}

}
